const app =getApp()
Page({
  data: {
    avatar: '',
    name: '',
    number:'',
    phone:'',
    year:'',
    month:'',
  },
  onLoad() {
     // 用户未登录时不必请求
    this.getUserProfile()
    this.getTask()
  },
  async getTask(){
    const res =await wx.$http.get('/driver/users/taskReport',{month:'07',year:'2022'})
    console.log(res);
  },
  async getUserProfile() {
    // 调用接口获取昵称和头像
    const { avatar, name,number,phone } = await wx.$http.get('/driver/users')
    // 渲染数据
    this.setData({ avatar, name ,number,phone})
    // 将头像和昵称存到应用实例中
    app.userInfo = {  avatar:this.data.avatar, name:this.data.name ,number:this.data.number,phone:this.data.phone }
  }
})